package mk;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.*;
public class AddDelModSel {
	List<Student> list = new LinkedList<Student>();
	Student stu = new Student();
	
	AddDelModSel(Student stu){
		
		this.stu=stu;
	}
	
	AddDelModSel(){
		
	}
	String	scId;
	//添加学生信息 
	int sAge,ran;
	String sName,sSex,sGrade;
	
	public void add(){
	try{
	 BufferedReader  br = new BufferedReader(new InputStreamReader(System.in));
	//	String read = br.readLine();
	    System.out.println("请输入学号");		
 	     scId = br.readLine();
 	     //stu.setId(scId);
	    
		System.out.println("请输入姓名");
	String	 read =br.readLine();
		 stu.setName(read);
   
		System.out.println("请输入性别");
		  read=br.readLine();
		 stu.setSex(read);

		System.out.println("请输入年龄");
		 sAge = br.read();
         stu.setAge(sAge);
		
		System.out.println("请输入班级");
	     sGrade = br.readLine();
	     stu.setGrade(sGrade);

        Random r = new Random();
        ran = (int)r.nextInt()*50+50;
        stu.setScore(ran);
        
        Student stu1 = new Student();
        list.add(stu1);
        System.out.println("添加信息成功");
        
		}catch(IOException e)
		{
			e.printStackTrace();
		}
        
       // Student stu1 = new Student(scId,sName,sSex,sAge,sGrade,ran);
      
	}
	
	//查询全部学生信息
	public void all_Select(){
		if(list==null)
		{
			System.out.println("没有任何信息");
		}else{
		for(int i=0;i<list.size();i++)
		{
			  Object obj = list.get(i);
			 if(obj instanceof Student){
			 	Student st = (Student)obj;
				System.out.println(st.getId()+" "+st.getName()+" "+st.getSex()+" "+st.getAge()+" "+st.getGrade()+" "+st.getScore());
			}
		  }
		}
	}
	
	
	//修改学生信息
	public void mod(int id){
		
	}
	
	
	
}
 